package com.github.demo.validation;

import com.github.jsoncat.annotation.springmvc.PostMapping;
import com.github.jsoncat.annotation.springmvc.RequestBody;
import com.github.jsoncat.annotation.springmvc.RestController;
import com.github.jsoncat.annotation.validation.Validated;

import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Validated
@RestController("/cars")
public class CarController {

    @PostMapping("/new")
    public CarDto create(@RequestBody @Valid CarDto carDto) {
        return carDto;
    }

    public static void main(String[] args) {
        List<String> strings = Arrays.asList("1", "2");
        List<String> strings1 = new ArrayList<String>() {{
            this.add("1");
            this.add("2");
        }};
        System.out.println(strings.contains(1));
        System.out.println(strings1.contains(1));
    }
}
